<?php
/**
 *装饰件函数
 * @param type $params
 * @param type $content
 * @return boolean 
 */
function asset($params, $content) {
    $pam = "";
    foreach ($params as $key => $value) {
        if ($key != "name" && $key != "action") {
            $pam .= "$".$key . "='" . $value . "',";
        }
    }
    if (isset($content)) {
        $pam .= '$content='."'$content'";
        if (isset($params['name'])) {
            $name = "\\assets\\" . $params['name'].'\\asset';
            $config = \core\config::getAsset($params['name']);
            $asset = new $name($config);
            if (isset($params['action'])) {
                $action = $params['action'];
                $do = '$asset->' . $action . '(' . $pam . ');';
                eval($do);
            } else {
                $do = '$asset->index(' . $pam . ');';
                eval($do);
            }
        } else {
            return false;
        }
    }
}
?>
